//Http 模块:开发后台程序

const http = require("http")

const url = require("url")

const server = http.createServer((req, res) => {
    //打印请求
    // console.log(req)

    if (req.method == "GET") {
        console.log("这是GET请求")
        console.log("", req.url) //得到请求的路径

        const paramsObj = url.parse(req.url, true)
        console.log(paramsObj)


    } else {
        console.log("这不是GET请求")
    }

    res.end("hello!")
})

server.listen(3000, () => {
    console.log("服务器已经启动并开始在3000端口监听了");

})